<template>
	<view>
		<view>登录保存的CID：{{ cacheCid }}</view>
		<view>最新的CID：{{ newCid }}</view>
<!-- 		<view @tap="nav(`/subpackage/income/pages/other-cost/index`)">其他成本</view>
		<view @tap="nav(`/subpackage/member/pages/setting/calendar`)">休息</view>
		<view @tap="nav(`/subpackage/storehouse/pages/worker/parts/index`)">个人仓库</view>
		<view @tap="nav(`/subpackage/member/pages/warehouse/PartsApplyLogList/index`)">申领配件</view> -->
		<button @tap="doUpdate">检查更新</button>
		<button @tap="startKeep">开启保活</button>
	</view>
</template>

<script>
import { cache } from "@/utils"
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update.js'
const JModule = uni.requireNativePlugin("J-FrontService");
export default{
	data(){
		return {
			cacheCid: "暂无",
			newCid: ""
		}
	},
	onLoad(){
		this.cacheCid = cache.get.pushCid()
		// #ifdef APP-PLUS
		plus.push.getClientInfoAsync(info => {
			this.newCid = info.clientid
		})
		// #endif
	},
	methods: {
		doUpdate(){
			console.log('----')
			uni.showModal({
				title: "检查更新",
				content: "sssss"
			})
			checkUpdate()
		},
		startKeep(){
			JModule.startFrontService({
			    // Android生效的配置
			    title: '南天快修',
			    content: '南天快修应用正在运行',
			    // IOS生效的配置
			    localtion: true,    // 后台持续定位保活
			    voice: true         // 播放无声音乐保活
			}, res => {
			    let { flag, msg } = res
				console.log(flag, msg,'应用保活启动参数')
			    // flag 为 true，开启成功，否则失败
			    // msg 为 成功失败的消息
			})
		}
	}
}
</script>

<style>
</style>